﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common
{
    /// <summary>
    /// 
    /// </summary>
    public class RegexPatterns
    {
        public const string US_Date =
            @"^(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$";
        public const string Date_YYYYMMDD = @"(19|20)\d\d[-\s/\.](0[1-9]|1[012])[-\s/\.](0[1-9]|[12][0-9]|3[01])";
        public const string Date_MMDDYYYY = @"(0[1-9]|1[012])[-\s/\.](0[1-9]|[12][0-9]|3[01])[-\s/\.](19|20)\d\d";
        public const string Date_DDMMYYYY = @"(0[1-9]|[12][0-9]|3[01])[-\s/\.](0[1-9]|1[012])[-\s/\.](19|20)\d\d";
        public const string Date_MMMYYYY = @"(Jan|January|Feb|February|Mar|March|Apr|April|May|Jun|June|Jul|July|Aug|August|Sep|Sept|September|Oct|October|Nov|November|Dec|December)[-\s\.]+(19|20)\d\d";
        public const string Date_MMMDDYYYY = @"(Jan|January|Feb|February|Mar|March|Apr|April|May|Jun|June|Jul|July|Aug|August|Sep|Sept|September|Oct|October|Nov|November|Dec|December)[-\s\.]+(0[1-9]|[12][0-9]|3[01])[-\s\.]+(19|20)\d\d";
        public const string Date_Quater = @"(Spring|Spr|Summer|Sum|Fall|Winter|Win)[\s\.]+(19|20)\d\d";

        public const string PersonName_FirstLast = @"^([A-Z][a-z]*)\s+([A-Z][a-z]+)$";
        public const string PersonName_FirstMidLast = @"^([A-Z][a-z]*)\s+([A-Z])\.?([A-Z][a-z]+)$";
        public const string PersonName_LastFirst = @"^([A-Z][a-z]+),?\s*([A-Z][a-z]*)$";
        public const string PersonName_LastFirstMid = @"^([A-Z][a-z]+),?\s*([A-Z][a-z]*)\s+([A-Z])\.?$";
        public const string PersonName = @"^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$";
        public const string PersonName_LastFM_Multiple = @"([a-zA-Z]+),\s*([A-Z]\.\s?)*(\band\b|,|&|\s+)?";

        public const string URL = @"((((https?|ftps?|gopher|telnet|nntp)://)|(mailto:|news:))(%[0-9A-Fa-f]{2}|[-()_.!~*';/?:@&=+$,A-Za-z0-9])+)([).!';/?:,][[:blank:]])?";
        public const string IP = @"^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
        public const string Email = @"^[\w\-\+\&\*]+(?:\.[\w\-\_\+\&\*]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$";
        public const string CreditCard = @"^((4\d{3})|(5[1-5]\d{2})|(6011)|(7\d{3}))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$";

        public const string US_States =
            @"^(AE|AL|AK|AP|AS|AZ|AR|CA|CO|CT|DE|DC|FM|FL|GA|GU|HI|ID|IL|IN|IA|KS|KY|LA|ME|MH|MD|MA|MI|MN|MS|MO|MP|MT|NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PW|PA|PR|RI|SC|SD|TN|TX|UT|VT|VI|VA|WA|WV|WI|WY)$";
        public const string SSN = @"^\d{3}-\d{2}-\d{4}$";
        public const string FloatingNumber = @"^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$";
        public const string Guid = @"^[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}$";
        public const string DomainName = @"^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$";
        public const string ValidFileName=@"^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(\..+)?$)[^\x00-\x1f\\?*:\;|/]+$";
        public const string Months = @"Jan|January|Feb|February|Mar|March|Apr|April|May|Jun|June|Jul|July|Aug|August|Sep|Sept|September|Oct|October|Nov|November|Dec|December";
        public const string Quarters = @"Spring|Spr|Summer|Sum|Fall|Autumn|Winter|Win";

    }
}
